when adding new device model for the first time -
need to set for slave mode first
then switch back to master mode



if zebex is in the slave mode
-----------------------------
1. dev port name used == "Bluetooth-PDA-Sync" has problems
2. dev port name used == "ZEBEX-SPPslave-1" is used , then slave mode works!


if zebex is in the master mode
------------------------------
(with the correct target bluetooth address of cpu)
1. dev port name used == "Bluetooth-PDA-Sync" has problems (not always okay)
	the zebex has to be ON first - then run this app = ok - light stays on after port closes
	if run app first, then zebex on later => does pair up - but longer and light stays on after port closes
2. dev port name used == "ZEBEX-SPPslave-1" is used , ???!
	a. need to turn on zebex first, then works almost right away
			light does NOT go off after port closes
	b. if app first, then zebex, == does NOT work very well
		light goes off after port closes

PROBLEM with using "ZEBEX-SPPslave-1"
then we will need to know - 
	"ZEBEX-SPPslave-2"
	"ZEBEX-SPPslave-3"
	"ZEBEX-SPPslave-n"
is that each new physical ZEBEX device will get assigned a unique slave number
then we have to know in advance which one matches our physical scanner with the bluetooth device list in the pref


so far it seems to best use the master mode,
use "Bluetooth-PDA-Sync"
- turn ON the ZEBEX first
- then 






		bool doTest = false;
		if ( doTest )
		{
			myPrintf ("barcodeDataFileMgr::getARecord => TESTING....\n\n" );

			// try to test
			mystringstream	oneLineStream;
			oneLineStream.open();
			oneLineStream << fLineBuffer;
			
			oneLineStream.width(50);	// per field basis
			char oneField[51];
			
			short maxFields = 0;
			bool done	= false;
			
			do
			{
				if ( oneLineStream.good() && (!oneLineStream.eof()) )
				{
					memset ( oneField, 0, sizeof(oneField) );
					oneLineStream >> oneField;
					cout << "SPECIAL Got a FieldData = [" << oneField << "]\n";
					++maxFields;
				}
				else
				{
					myPrintf ("HAS PROBLEM\n\n" );
					done = true;;
				}
				if ( maxFields>20 )
					done = true;
			}while (!done);
			
			return false;
		}
		


	{
		class outbuf : public std::streambuf
    {
protected:
		/* central output function
		* - print characters in uppercase mode
		*/
		virtual int_type overflow (int_type c) {
			if (c != EOF) {
				// convert lowercase to uppercase
				c = std::toupper(static_cast<char>(c),getloc());
				
				// and write the character to the standard output
				if (putchar(c) == EOF) {
					return EOF;
				}
			}
			return c;
		}
    };		outbuf ob;
		// initialize output stream with that output buffer
		std::ostream out(&ob);
		
		out << "31 hexadecimal: "
			<< std::hex << 31 << std::endl;

		char FirstName[30];
		memset ( FirstName, 0, sizeof(FirstName) );
		
		char FileName[100];
		memset ( FileName, 0, sizeof(FileName) );
		strcpy ( FileName, "LookForSteveFile.txt" );
		std::ofstream Students(FileName, ios::out);
		Students << "HelloWorld \nAnd so on and on and on!!!!!\nHelloWorld \nAnd so on and on and on!!!!!\n";

		cout << "\n\nWrote to the File Called: [" << FileName << "]\n\n\n";
		
		return;
	}










project copied from the final working slave mode method



works well in slave mode


 RF Connect
 SLAVE Mode
 Wait Online
Func Key Exit


try to make the slave mode work


To pair up correctly for the first time

1. need to set pdx device to SLAVE mode
2. goto apple bluetooth pref and discover the "ZEBEX"
3. then wait for zebex device to become connected
4. then set the zebex device to MASTER Mode
5. enter the bluetooth interface ID (id of the usb/bluetooth or cpu's bluetooth address)








class pdxProDevice: public serialRS232Device
{
public:
	bool	EnterRemoteMode();
	bool	QuitRemoteMode();
	void	DoDebugTest(void);
	bool	SendBegin05Cmd();	// 04-23-07
	bool	SendEnd06Cmd();	// 04-23-07
	bool	GetDateInfoCmd();	// 04-23-07
	bool	GetTimeInfoCmd();	// 04-23-07
	
	
};

// STEVE
// Given the file descriptor for a modem device, attempt to initialize the modem by sending it
// a standard AT command and reading the response. If successful, the modem's response will be "OK".
// Return true if successful, otherwise false.
const char	kPdxPro_EnterRemoteMode1Cmd[]		= {0x55,0x00};	// STEVE
const char	kPdxPro_EnterRemoteMode2Cmd[]		= {0x54,0x00};	// STEVE
const char	kPdxPro_QuitRemoteModeCmd[]			= {0x01b,0x00};	// STEVE
const char	kPdxPro_Begin05Cmd[]				= {0x05,0x00};	// STEVE
const char	kPdxPro_End06Cmd[]					= {0x06,0x00};	// STEVE
const char	kPdxPro_GetDateInfoCmd[]			= {0x02,'R','D',0x03,0x00};	// STEVE
const char	kPdxPro_GetTimeInfoCmd[]			= {0x02,'R','T',0x03,0x00};	// STEVE

const char	kPdxPro_AckResp06Cmd[]				= {0x06,0x00};	// STEVE
const char	kPdxPro_AckResp07Cmd[]				= {0x07,0x00};	// STEVE






// 04-06-07

1. got it to work on todd's ppc machine




SerialPortSample
Command-line tool demonstrating how to do serial I/O on Mac OS X.

Version: 1.3
10/15/2002

Techniques shown are:
- Finding a serial port
- Opening and configuring the port
- Sending an "AT" command to a modem attached to the port
- Reading the "OK" response from the modem (if any)
- Closing the port

Includes Project Builder 2.1, CodeWarrior 8.2 Mach-O, and Xcode 2.1 projects.

Version: 1.4
07/20/2005

- Updated to produce a universal binary.
- Added examples of setting arbitrary baud rates and the read timer latency. 
- Use kIOMasterPortDefault instead of older IOMasterPort function.
